package com.cxria.activemq.web.listener;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class ConsumerMessageListener implements MessageListener {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    public void onMessage(Message message) {
        TextMessage tm = (TextMessage) message;
        try {
            logger.info("接收者受到消息：" + tm.getText());
        } catch (JMSException e) {
            logger.error(e.getMessage());
        }
    }

}
